#!/bin/sh
#
# This is to be executed by xinit as well as by display managers.
# It takes a program and its arguments, which it is supposed to exec
# once it's done setting up its own stuff.
#
# The base script does not do much. It only sources files in Xsession.d.
#
# Copyright 2022 Daniel "q66" Kolesa <q66@chimera-linux.org>
#

if [ ! -d /etc/X11/Xsession.d ]; then
    exec "$@"
fi

for f in /etc/X11/Xsession.d/*; do
    [ ! -x "$f" ] && continue
    . "$f"
done

unset f

exec "$@"
